package com.me.rabbitMQ.route;

import com.me.rabbitMQ.util.ConnectionUtil;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

public class Sender {
    private final static String EXCHANGE_NAME = "test_route";

    public static void main(String[] argv) throws Exception{
        Connection connection = ConnectionUtil.getConnect();
        Channel channel = connection.createChannel();
        channel.exchangeDeclare(EXCHANGE_NAME, "direct");//定义一个路由格式的交换机
        //发送消息
        channel.basicPublish(EXCHANGE_NAME, "key3", null, "路由消息".getBytes());
        //关闭连接
        channel.close();
        connection.close();
    }

}
